/*
 * @Author: Jimmy
 * @LastModifiedBy: Jimmy
 * @Date: 2024-05-25 17:31:22
 * @LastEditTime: 2024-09-07 20:42:31
 * @FilePath: /nest_study/server/src/modules/system/post/post.controller.ts
 */
import { Controller, Get, Post, Body, Request, Delete, Put, Query } from '@nestjs/common';
import { PostService } from './post.service';
import { CreatePostDto, DeletePostrDto, QueryPostDto, UpdatePostDto } from './dto/index.dto';
import { ApiBearerAuth, ApiBody, ApiOperation, ApiTags } from '@nestjs/swagger';


@ApiTags('职位管理')
@ApiBearerAuth()
@Controller('system/post')
export class PostController {
  constructor(private readonly postService: PostService) { }

  @ApiOperation({
    summary: '职位-创建'
  })
  @ApiBody({
    type: CreatePostDto,
    required: true
  })
  @Post('/create')
  create(@Body() createPostDto: CreatePostDto, @Request() req) {
    return this.postService.create(createPostDto);
  }

  @ApiOperation({
    summary: '职位-更新'
  })
  @ApiBody({
    type: UpdatePostDto,
    required: true
  })
  @Put('/update')
  update(@Body() updateDto: UpdatePostDto, @Request() req) {
    return this.postService.update(updateDto);
  }

  @ApiOperation({
    summary: '职位-删除'
  })
  @ApiBody({
    type: DeletePostrDto,
    required: true
  })
  @Delete('/delete')
  delete(@Body() postInfo: DeletePostrDto) {
    return this.postService.delete(postInfo);
  }

  @ApiOperation({
    summary: '职位-列表'
  })
  @ApiBody({
    type: QueryPostDto,
    required: true
  })
  @Get('/list')
  list(@Query() query: QueryPostDto) {
    return this.postService.findAll(query);
  }
}
